package com.klangner.math.transform;

import junit.framework.TestCase;

import com.klangner.math.ast.Node;
import com.klangner.math.parser.ExpressionParser;

public class MultiplyTransTestCase extends TestCase {

	/** 
	 * Test data. Format:
	 * input => expected output 
	 */
	private static final String[][] testData = {
		{"2*3","6"},
		{"4/2","2"},
		{"4/2*3","6"},
		{"2+3","2+3"},
		{"2*3+3","6+3"},
		{"4/-2*3","4/-2*3"}
	};
	
	
	public void testData() {
		Node document;
		Node result;
		ExpressionParser parser = new ExpressionParser();
		AddTransform trans = new AddTransform();
		
		for(int i = 0; i < testData.length; i++){
		
			document = parser.parse( testData[i][0] );
			result = document.transform(trans);
			assertEquals("Input: " + testData[i][0], testData[i][1], result.toString());
		}
	}

}

